<?php
$chart_settings = new Setting_model();
$reload_period = empty($_GET['formdate'])?$chart_settings->get_chart_reload():(int)86400;
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?php echo isset($title)?$title:"Статистика"; ?></title>
        <link href="/css/style.css" rel="stylesheet" type="text/css">
        <link rel="icon" href="/favicon.ico" type="image/x-icon">
        <meta http-equiv='Refresh' content='<?=$reload_period?>'>
        <link type="text/css" href="/css/smoothness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />
        <script type="text/javascript" src="/js/jquery/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="/js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
        <script type="text/javascript" src="/js/jsfunc.js"></script>

<!--  lightbox      -->
        <script type="text/javascript" src="/js/jquery/jquery.lightbox-0.5.min.js"></script>
        <link type="text/css" href="/css/jquery.lightbox-0.5.css" rel="Stylesheet" />

        <!--[if lte IE 7]>
        <style type="text/css">
            .chartcell{
                display: inline !important;
            }
        </style>
        <![endif]-->

    </head>
    <body>
        <div>
        <div id="chartheader">
            <div id="chartheaderleft">
                <a href="/" alt="На главную" title="На главную"><img src="/images/home.png" border="0" style="vertical-align: middle;"></a> <a href="/" alt="На главную" title="На главную"><b>На главную</b></a>
            </div>
            <div id="chartheaderright">
                <small>Последнее обновление: <?=date("d.m.Y H:i:s")?><br>
                Следующее обновление: <?=date("d.m.Y H:i:s",time()+$reload_period)?></small>
            </div>
        </div>
        <center>
            <!-- content -->
            <?=$content?>
            <!-- end content -->
            <br /><br />
            <hr style='width: 70%;'/>
            <br>
            <form action="" method="GET" id="formchart">
                <table border="1" cellpadding="0" cellspacing="0" class="tblform"><tr>
                <td>Построить за</td>
                <td>
                    <select name="formperiod">
                        <?php foreach($chart_settings->form_chart_period as $key => $value): ?>
                            <?php if("$key" === @$_GET['formperiod']): ?>
                                <option value="<?=$key?>" selected><?=$value?></option>
                            <?php else: ?>
                                <option value="<?=$key?>"><?=$value?></option>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td>
                    <img src="/images/l-button.png" id="date-minus" class="hand"/>
                </td>
                <td>
                    с
                    <input type="text" name="formdate" id="date" maxlength="10" value="<?=empty($_GET['formdate'])?'':$chart_date?>">
                </td>
                <td>
                    <img src="/images/r-button.png" id="date-plus" class="hand"/>
                </td>
                <td>размер
                    <input type="text" maxlength="4" class="inpform" name="formwidth"  value="<?=isset($_GET['formwidth'])?$chart_width:$chart_settings->get_chart_width()?>">x
                    <input type="text" maxlength="4" class="inpform" name="formheight" value="<?=isset($_GET['formheight'])?$chart_height:$chart_settings->get_chart_height()?>">
                </td>
                <td>maxOy
                    <input type="text" maxlength="8" class="inpform" name="formmaxoy" value="<?=!empty($_GET['formmaxoy'])?my_digit_only($_GET['formmaxoy']):''?>">
                </td>
                <td><input type="submit" value="Ok" name="submitperiod" style="width:50px;" tabindex="1"></td>
                <!--td rowspan="2"><input type="submit" value="Ok" class="gethistory" name="submitall"></td-->
                </tr>
                </table>
            </form>
            <br><br>
        </center>

        </div>
        
        <div id="footer2-container">
            <div id="footer2">
                <a id="totop" href="#chartheader">↑ Вверх</a>
            </div>
        </div>

    </body>
</html>